<?php

// +----------------------------------------------------------------------
// | Apprh.Shop
// +----------------------------------------------------------------------
// | Copyright (c) 2017-2027 http://www.apprh.com All rights reserved.
// +----------------------------------------------------------------------
// | Notice: This code is not open source, it is strictly prohibited
// |         to distribute the copy, otherwise it will pursue its
// |         legal responsibility.
// +----------------------------------------------------------------------
// | Author: 雲溪荏苒 <290648237@qq.com>
// +----------------------------------------------------------------------

namespace app\frontend\controller;

use controller\HomeBase;
use think\Request;


/**
 * 网站产品控制器
 *
 * Class Product
 * @package app\frontend\controller
 * @author 雲溪荏苒 <290648237@qq.com>
 * @date 2017/12/9
 */
class Product extends HomeBase
{

    function __construct(Request $request = null)
    {
        parent::__construct($request);
        // 获取产品分类列表
        $productClassList = model('product_class')->getList(['status'=>1]);
        $this->assign('productClassList', $productClassList);
    }

    /**
     * 网站案例
     * @return mixed
     */
    public function index()
    {
        $this->assign('generator', request()->domain().'/,cn,107,,3,M1156010');
        $this->assign('body_class', 'class-107');

        $productList = model('product')->getProductList(6, 9);
        $this->assign('productList', $productList);
//        dump($productList);die;

        // SEO
        $this->assign('seo_title', '网站设计推荐案例,网站建设推荐案例,网站制作推荐案例 - '.sysconf('seo_title'));
        $this->assign('seo_keywords', '网站设计推荐案例,网站建设推荐案例,网站制作推荐案例,立鼎科技精品推荐案例,'.sysconf('seo_keywords'));
        $this->assign('seo_description', '知名网站建设公司立鼎科技的网站案例，凭借优质的服务品质，超前的设计理念为众多企业提供优质的官方网站，做网站请选立鼎科技，了解更多精品推荐案例请致电'.sysconf('hc_phone').'。'.sysconf('seo_description'));

        return $this->fetch('');
    }

    public function lists()
    {
        $cid = I('cid', 0);
        $this->assign('cur_cid', $cid);

        $this->assign('generator', request()->domain().'/,cn,'.$cid.',,3,M1156010');
        $this->assign('body_class', 'class-'.$cid);

        list($productList, $pTotal) = model('product')->getList(['status' => 1, 'cid' => $cid]);
        $this->assign('productList', $productList);
//        dump($productList);die;
        $this->assign('seo_title', '网站设计推荐案例,网站建设推荐案例,网站制作推荐案例 - '.sysconf('seo_title'));
        $this->assign('seo_keywords', '网站设计推荐案例,网站建设推荐案例,网站制作推荐案例,立鼎科技精品推荐案例,'.sysconf('seo_keywords'));
        $this->assign('seo_description', '知名网站建设公司立鼎科技的网站案例，凭借优质的服务品质，超前的设计理念为众多企业提供优质的官方网站，做网站请选立鼎科技，了解更多精品推荐案例请致电'.sysconf('hc_phone').'。'.sysconf('seo_description'));

        return $this->fetch('');
    }

    public function show()
    {
        $info = model('product')->getOneProduct(I('product_id'));
        $this->assign('info', $info);
        $this->assign('cur_cid', $info['cid']);

        $this->assign('generator', request()->domain().'/,cn,'.$info['cid'].',,3,M1156010');
        $this->assign('body_class', 'class-'.$info['cid']);

        // 推荐产品
        list($recProductList, $pTotal) = model('product')->getList(['status' => 1, 'is_recommend' => 1], 0, 6, 'view desc');
        $this->assign('recProductList', $recProductList);

        // 访问量+1
        model('product')->setViewInc(I('product_id'));

        $this->assign('seo_title', '网站设计推荐案例,网站建设推荐案例,网站制作推荐案例 - '.sysconf('seo_title'));
        $this->assign('seo_keywords', '网站设计推荐案例,网站建设推荐案例,网站制作推荐案例,立鼎科技精品推荐案例,'.sysconf('seo_keywords'));
        $this->assign('seo_description', '知名网站建设公司立鼎科技的网站案例，凭借优质的服务品质，超前的设计理念为众多企业提供优质的官方网站，做网站请选立鼎科技，了解更多精品推荐案例请致电'.sysconf('hc_phone').'。'.sysconf('seo_description'));

        return $this->fetch('');
    }

}
